<template>
  <div id="trainIndex">
    <el-dialog title="已手动添加人选列表" :visible.sync="additionalPersonListVisible" width="98%" top="20px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
      <!-- <el-button type="success" @click="additionalPerson" style="float:right;position:fixed;right:60px;top:170px;">手动添加人选</el-button> -->
      <additional-person :deptId="userTeam" type="filed" :timestamp="timestamp" @refreshRecommented="refreshRecommented" @addToFiled="handleAddAdditional" />
    </el-dialog>
    <el-dialog title="人员信息详情" :visible.sync="personDetailVisible" width="80%" top="20px" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
      <personInfo :personId='personId' :hidemoredetail="true"></personInfo>
    </el-dialog>
    <el-dialog title="查看班次" :visible.sync="classVisible" width="98%" top="20px" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body="true" >
      <div>
        <class-detail :id="showClassId" :showPerson="userType!==2" />
      </div>
    </el-dialog>
    <el-dialog :title="jobDateForm.name+' 任相当层次职务职级时间'" :visible.sync="jobDateFormVisible" width="500px" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body="true" >
      <div>
        <el-form :model="jobDateForm" :rules="jobDateFormRules" ref="jobDateForm">
          <el-form-item label="" prop="jobDate" v-if="canEdit">
            <el-input v-model="jobDateForm.jobDate" auto-complete="off" style="width:150px;" :maxlength="8"></el-input>
            <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
              <el-button type="text" icon="el-icon-info" />
            </el-tooltip>
            <el-button type="primary" style="margin-left:10px" :loading="addLoading" @click="submitJobDateForm">保存</el-button>
            <el-button type="danger" v-if="jobDateRemoveVisible" style="margin-left:10px" :loading="addLoading" @click="removeJobDate">删除</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>
    <el-dialog :title="addFormTitle" :visible.sync="addFormVisible" width="98%" top="20px" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body="true" >
      <div v-if="loading">数据读取中...
      </div>
      <div v-else id="trainEditTable">
        <el-form :model="addForm" :rules="addFormRules" ref="addForm">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th width="100px">单位</th>
              <td colspan="3">
                {{addForm.unitName}}
              </td>
            </tr>
            <tr>
              <th width="100px">姓名</th>
              <td width="500px">
                {{addForm.name}}
              </td>
              <th width="100px">身份证号</th>
              <td width="500px">
                {{addForm.idCardNo}}
              </td>
            </tr>
            <tr>
              <th>年龄</th>
              <td>
                {{addForm.age}}
              </td>
              <th>职务</th>
              <td>
                {{addForm.job}}
              </td>
            </tr>
            <tr>
              <th>级别</th>
              <td>
                {{addForm.level}}
              </td>
              <th>是否党员</th>
              <td>
                {{addForm.partyMember}}
              </td>
            </tr>
            <tr>
              <th>任相当层次职务职级时间</th>
              <td>
                <!-- <el-form-item label="" prop="jobDate" v-if="canEdit">
                  <el-input v-model="addForm.jobDate" auto-complete="off" style="width:150px;" :maxlength="8"></el-input>
                  <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                    <el-button type="text" icon="el-icon-info" />
                  </el-tooltip>
                  <div v-if="A0192X">公务员系统任相当层次职务职级时间：{{A0192X}}<el-button type="text" style="margin-left:10px" @click="addForm.jobDate=A0192X" icon="el-icon-edit">填入</el-button></div>
                  <div v-if="jobDate">干部培训归档数据任相当层次职务职级时间：{{jobDate}}<el-button type="text" style="margin-left:10px" @click="addForm.jobDate=jobDate" icon="el-icon-edit">填入</el-button></div>
                </el-form-item> -->
                <span>{{formatJobDate(addForm.jobDate)}}</span>
              </td>
              <th>任现职务层次时间</th>
              <td>
                <span>{{formatJobDate(addForm.a0288)}}</span>
              </td>
            </tr>
            <tr>
              <th>参训时间</th>
              <td>
                <el-radio-group v-model="dateType" v-if="canEdit">
                  <el-radio :label="1">日期明确</el-radio>
                  <el-date-picker :clearable="false" v-if="dateType===1" key="trainingDate" type="daterange" v-model="addForm.trainingDate" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"  format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="setDuration" />
                  <span style="font-size:16px;margin-left:10px;" v-if="addForm.duration&&dateType===1">{{addForm.duration}}天</span>
                  <div style="clear:both" />
                  <el-radio :label="2">日期不明确</el-radio>
                  <template v-if="dateType===2">
                    <el-input placeholder="参训时间描述" v-model="addForm.trainingDateRemark" auto-complete="off" style="width:300px;" :maxlength="50"></el-input>
                    <el-date-picker key="trainingYear" v-model="addForm.trainingYear" placeholder="选择参训年份" type="year" format="yyyy" value-format="yyyy"  />
                  </template>
                </el-radio-group>
                <template v-else>
                  <span v-if="dateType===1">{{addForm.trainingDate[0]}}至{{addForm.trainingDate[1]}}（{{addForm.duration}}天）</span>
                  <span v-if="dateType===2">{{addForm.trainingDateRemark}}</span>
                  <span v-if="dateType===2">（参训年份：{{addForm.trainingYear}}年）</span>
                </template>
              </td>
              <th>举办单位</th>
              <td>
                <el-form-item label="" prop="trainUnit" v-if="canEdit">
                  <el-input v-model="addForm.trainUnit" auto-complete="off" style="width:300px;" :maxlength="50"></el-input>
                </el-form-item>
                <span v-else>{{addForm.trainUnit}}</span>
              </td>
            </tr>
            <tr>
              <th>班次名称</th>
              <td>
                <el-form-item label="" prop="className" v-if="canEdit">
                  <el-input v-model="addForm.className" auto-complete="off" style="width:300px;" :maxlength="50"></el-input>
                </el-form-item>
                <span v-else>{{addForm.className}}</span>
              </td>
              <th>参训地点</th>
              <td>
                <el-form-item label="" prop="place" v-if="canEdit">
                  <el-input v-model="addForm.place" auto-complete="off" style="width:300px;" :maxlength="50"></el-input>
                </el-form-item>
                <span v-else>{{addForm.place}}</span>
              </td>
            </tr>
          </table>
        </el-form>
        <el-button type="primary" style="margin-left:10px" v-if="canEdit" :loading="addLoading" @click="submitForm">保存</el-button>
      </div>
    </el-dialog>
    <el-dialog title="导出" :visible.sync="exportVisible" width="600px" :close-on-click-modal="false" :close-on-press-escape="false" >
      <div id="trainEditTable">
        <el-form :model="exportForm" ref="exportForm" label-width="120px">
          <el-form-item label="导出方式" v-if="viewtype===2">
            <el-radio-group v-model="exportType">
              <el-radio :label="1">按单位类型导出</el-radio>
              <el-radio :label="2" :disabled="!ids.length">按所选人员导出<span v-if="!ids.length">（未选人员）</span></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="已经选中人员" v-if="exportType===2">
            <el-tag
              style="margin-right:5px"
              :key="'export'+index"
              v-for="(item,index) in ids"
              closable
              @close="removeExport(item)">
              {{item.a0101}}
            </el-tag>
            <span>（共{{ids.length}}人）</span>
          </el-form-item>
          <el-form-item label="单位类型" v-if="exportType===1">
            <el-select v-model="exportForm.team" placeholder="请选择" style="width:110px">
              <el-option label="全部" :value="null"></el-option>
              <el-option v-for="(item, index) in teams" :key="'exportTeam'+index" :label="item" :value="index+1"></el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="参训年份">
            <el-select v-model="exportForm.year" placeholder="请选择" style="width:100px">
              <el-option label="全部" :value="null"></el-option>
              <el-option v-for="(item, index) in yearlist" :key="'exportYear'+index" :label="item" :value="item"></el-option>
            </el-select>
          </el-form-item> -->
          <el-form-item label="">
            <el-button type="primary" @click="exportData" :disabled="exportType===2&&ids.length===0">导出</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>
    <el-dialog title="按单位导出人员" :visible.sync="exportVisibleAll" width="600px" :close-on-click-modal="false" :close-on-press-escape="false" >
      <div id="trainEditTable">
        <!-- <el-form :model="exportAllForm" ref="exportAllForm" label-width="50px">
          <el-form-item label="单位">
            <el-select v-model="exportAllForm.unitId" placeholder="请选择" style="width:400px" filterable>
              <el-option label="全部" :value="null"></el-option>
              <el-option v-for="(item, index) in units" :key="'units'+index" :label="item.unitName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-button type="primary" @click="exportAllDataByUnit" :disabled="exportType===2&&ids.length===0">导出</el-button>
          </el-form-item>
        </el-form> -->
        <div style="clear:both;margin:10px 0;">
          <el-input
            v-model="filterText"
            placeholder="输入关键字进行过滤"
            style="width:220px;margin-right:10px;float:left"
          />
          <template>
            <el-button v-if="selectAllBtn" type="primary" @click="selectTree(1)">全选</el-button>
            <el-button v-else type="primary" plain @click="selectTree(0)">取消</el-button>
          </template>
        </div>
        <el-tree
          ref="tree"
          show-checkbox
          node-key="id"
          :expand-on-click-node="false"
          :data="units"
          :filter-node-method="filterNode"
        />
        <el-button type="success" @click="exportAllDataByUnit" style="margin:20px;">导出</el-button>
      </div>
    </el-dialog>
    <el-dialog title="人员查询" :visible.sync="personVisible" width="600px" :close-on-click-modal="false" :close-on-press-escape="false" >
      <div id="trainEditTable">
        <el-form :model="personForm" ref="exportForm" label-width="120px">
          <el-form-item label="姓名">
            <el-input v-model="personForm.realName" style="width:230px;"></el-input>
          </el-form-item>
          <el-form-item label="单位">
            <el-input v-model="personForm.unitName" style="width:230px;"></el-input>
          </el-form-item>
          <el-form-item label="身份证号">
            <el-input v-model="personForm.idCardNo" style="width:230px;"></el-input>
          </el-form-item>
          <el-form-item label="">
            <el-button type="primary" @click="exportPersonData">导出</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>
    <section class="wboxs" :style="type==='filed'?'margin-bottom:0':'padding:0 ;border:0'">
      <div style="float:right;" v-if="type==='filed'">
        <div>
          <el-dropdown v-if="showManage||canEdit||inRoles('ROLE_training')">
            <el-button style="margin-top:10px">
              菜单<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-if="showManage" @click.native="handleIndex">培训管理</el-dropdown-item>
              <el-dropdown-item v-if="inRoles('ROLE_training')" @click.native="handleChart">分析</el-dropdown-item>
              <el-dropdown-item v-if="inRoles('ROLE_training')" @click.native="handleExport">导出</el-dropdown-item>
              <el-dropdown-item v-if="inRoles('ROLE_training')" @click.native="handleAuth">授权</el-dropdown-item>
              <el-dropdown-item v-if="viewtype===2&&inRoles('ROLE_training')" @click.native="handleExportAll">导出全部人员</el-dropdown-item>
              <el-dropdown-item v-if="viewtype===2&&inRoles('ROLE_training')" @click.native="handleExportAllShow">按单位导出人员</el-dropdown-item>
              <el-dropdown-item v-if="canEdit" @click.native="showAdditional">已手动添加人选列表</el-dropdown-item>
              <el-dropdown-item v-if="viewtype===1&&inRoles('ROLE_training')" @click.native="handleExportHidden">导出未输出归档记录</el-dropdown-item>
              <el-dropdown-item v-if="inRoles('ROLE_training')" @click.native="searchPerson">人员查询</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
        <!-- <el-button @click="handleIndex" style="margin:10px 0;color:#fff">培训管理</el-button>
        <template v-if="inRoles('ROLE_training')">
          <el-button type="primary" @click="handleChart" style="margin:10px 0;color:#fff">分析</el-button>
          <el-button type="info" @click="handleExport" style="margin:10px 0;color:#fff !important">导出</el-button>
          <el-button type="warning" @click="handleAuth" style="margin:10px 0;color:#fff !important">授权</el-button>
        </template>
        </div>
        <div style="float:right;">
          <el-button v-if="viewtype===2&&inRoles('ROLE_training')" type="info" @click="handleExportAll" style="margin:10px 0;color:#fff !important">导出全部人员</el-button>
          <el-button type="success" @click="showAdditional" icon="el-icon-add" style="margin:10px 0;color:#fff" v-if="canEdit">已手动添加人选列表</el-button>
        </div> -->
      </div>
      <div style="float:left;margin:10px 10px 0;">
        <el-form :inline="true" :model="filters" ref="filtersForm">
          <!-- <div :style="'height:'+(type==='filed'?110:50)+'px;overflow:hidden'"> -->
          <div v-show="showMore">
            <el-radio-group v-if="type==='filed'" v-model="viewtype" @change="changeViewType">
              <el-radio-button :label="2">全部人员</el-radio-button>
              <el-radio-button :label="1">已培训人员</el-radio-button>
            </el-radio-group>
            <el-form-item label="" prop="team">
              <el-select v-model="filters.team" placeholder="请选择" style="width:110px" v-if="!deptId&&userType!==2">
              <!-- <el-select v-model="filters.team" placeholder="请选择" style="width:110px"> -->
                <el-option label="全部" :value="null"></el-option>
                <el-option v-for="(item, index) in teams" :key="'team'+index" :label="item" :value="index+1"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="unitName">
              <el-input v-model="filters.unitName" style="width:150px;" placeholder="单位名称"></el-input>
            </el-form-item>
            <el-form-item label="" prop="key1">
              <el-input v-model="filters.key1" style="width:170px;" placeholder="姓名/身份证号"></el-input>
            </el-form-item>
            <el-form-item label="职务" prop="jobNotContain">
              <el-select v-model="filters.jobNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="job">
              <el-input v-model="filters.job" style="width:120px;" placeholder="职务关键词"></el-input>
                  <el-tooltip class="item" effect="dark" content="职务如需多个关键词查询，则用空格隔开" placement="top">
                    <el-button type="text" icon="el-icon-info" />
                  </el-tooltip>
            </el-form-item>
            <el-form-item label="班次" prop="classNameNotContain">
              <el-select v-model="filters.classNameNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="className">
              <el-input v-model="filters.className" style="width:130px;" placeholder="班次名称关键词"></el-input>
            </el-form-item>
            <!-- <el-form-item label="举办单位" prop="trainUnitNotContain">
              <el-select v-model="filters.trainUnitNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="trainUnit">
              <el-input v-model="filters.trainUnit" style="width:130px;" placeholder="举办单位关键词"></el-input>
            </el-form-item> -->
            <br v-if="type==='filed'" />
            <el-form-item label="参训地点" prop="placeNotContain">
              <el-select v-model="filters.placeNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="place">
              <el-input v-model="filters.place" style="width:130px;" placeholder="参训地点关键词"></el-input>
                  <el-tooltip class="item" effect="dark" content="参训地点如需多个关键词查询，则用空格隔开" placement="top">
                    <el-button type="text" icon="el-icon-info" />
                  </el-tooltip>
            </el-form-item>
            <el-form-item label="级别" prop="levelsNotContain">
              <el-select v-model="filters.levelsNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="levels">
              <el-select v-model="filters.levels" style="width:240px;" multiple placeholder="请选择级别">
                <el-option v-for="(item,index) in levelList" :key="'level_'+index" :label="item" :value="item" />
                <el-option label="未填写" value="" />
              </el-select>
            </el-form-item>
            <el-form-item label="年龄段" prop="ageFrom">
              <el-input-number v-model="filters.ageFrom" style="width:125px;" placeholder="开始年龄" controls-position="right" />
            </el-form-item>
            <el-form-item label="" prop="ageTo">
              <el-input-number v-model="filters.ageTo" style="width:125px;" placeholder="结束年龄" controls-position="right" />
            </el-form-item>
            <el-form-item label="培训时长" prop="durationNotContain">
              <el-select v-model="filters.durationNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="durationStart">
              <el-input-number v-model="filters.durationStart" style="width:125px;" placeholder="最少天数" controls-position="right" />
            </el-form-item>
            <el-form-item label="" prop="durationEnd">
              <el-input-number v-model="filters.durationEnd" style="width:125px;" placeholder="最多天数" controls-position="right" />
            </el-form-item>
            <br v-if="type==='filed'" />
            <el-form-item label="" prop="trained" v-show="viewtype===2">
              <el-select v-model="filters.trained" placeholder="请选择" style="width:120px">
                <el-option label="全部" :value="null"></el-option>
                <el-option label="已参加培训" :value="1"></el-option>
                <el-option label="未参加培训" :value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="是否党员" prop="partyMember">
              <el-select v-model="filters.partyMember" placeholder="请选择" style="width:80px">
                <el-option label="全部" :value="null"></el-option>
                <el-option label="是" :value="true"></el-option>
                <el-option label="否" :value="false"></el-option>
              </el-select>
            </el-form-item>
            <!-- <el-form-item label="最近参训年份">
              <el-select v-model="filters.trainingYear" placeholder="请选择" style="width:100px">
                <el-option label="全部" :value="null"></el-option>
                <el-option v-for="(item, index) in yearlist" :key="'year'+index" :label="item" :value="item"></el-option>
              </el-select>
            </el-form-item> -->
            <!-- <el-form-item>标记近
              <el-select v-model="filters.markYear" placeholder="请选择" style="width:90px">
                <el-option label="" :value="null"></el-option>
                <el-option v-for="item in 10" :key="'year'+item" :label="item" :value="item"></el-option>
              </el-select>年参训人员
            </el-form-item> -->
            <el-form-item prop="markYear">近
              <el-input-number v-model="filters.markYear" :min="1" :max="50" placeholder="请选择" style="width:110px;" controls-position="right" />年参训人员
              <!-- <el-select style="width:90px">
                <el-option label="" :value="null"></el-option>
                <el-option v-for="item in 10" :key="'year'+item" :label="item" :value="item"></el-option>
              </el-select> -->
            </el-form-item>
            <el-form-item prop="markYear2">近
              <el-input-number v-model="filters.markYear2" :min="1" :max="50" placeholder="请选择" style="width:110px;" controls-position="right" />年未参训人员
              <!-- <el-select style="width:90px">
                <el-option label="" :value="null"></el-option>
                <el-option v-for="item in 10" :key="'year'+item" :label="item" :value="item"></el-option>
              </el-select> -->
            </el-form-item>
            <el-form-item label="任相当层次职务职级时间" prop="jobDateNotContain">
              <el-select v-model="filters.jobDateNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="jobDateStart">
              <el-date-picker style="width:120px"
                v-model="filters.jobDateStart"
                type="month"
                placeholder="开始月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="" prop="jobDateEnd">
              <el-date-picker style="width:120px"
                v-model="filters.jobDateEnd"
                type="month"
                placeholder="结束月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>

            <br v-if="type==='filed'" />
            <el-form-item label="任现职务层次时间" prop="a0288NotContain">
              <el-select v-model="filters.a0288NotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="a0288Start">
              <el-date-picker style="width:120px"
                v-model="filters.a0288Start"
                type="month"
                placeholder="开始月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="" prop="a0288End">
              <el-date-picker style="width:120px"
                v-model="filters.a0288End"
                type="month"
                placeholder="结束月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="性别" prop="a0104">
              <el-select v-model="filters.a0104" placeholder="请选择" style="width:80px">
                <el-option label="全部" :value="null"></el-option>
                <el-option label="男" :value="'男'"></el-option>
                <el-option label="女" :value="'女'"></el-option>
                <el-option label="其他" :value="'其他'"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="任现职级时间" prop="a0192cNotContain">
              <el-select v-model="filters.a0192cNotContain" style="width:100px;" placeholder="请选择">
                <el-option label="包含" :value="null" />
                <el-option label="不包含" :value="1" />
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="a0192cStart">
              <el-date-picker style="width:120px"
                v-model="filters.a0192cStart"
                type="month"
                placeholder="开始月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>
            <el-form-item label="" prop="a0192cEnd">
              <el-date-picker style="width:120px"
                v-model="filters.a0192cEnd"
                type="month"
                placeholder="结束月份"
                value-format="yyyyMM">
              </el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="searchPrj">查询</el-button>
              <el-button @click="resetFilters">重置</el-button>
            </el-form-item>

            <el-form-item>
              <el-checkbox @change="changeHeight" v-model="showMore" style="width:60px;">更多条件</el-checkbox>
              <el-checkbox v-if="type==='filed'&&viewtype===2&&inRoles('ROLE_training')" v-model="showSelect" style="width:60px;">选择人员</el-checkbox>
            </el-form-item>
          </div>
          <div v-show="!showMore">
            <el-radio-group v-if="type==='filed'" v-model="viewtype" @change="changeViewType">
              <el-radio-button :label="2">全部人员</el-radio-button>
              <el-radio-button :label="1">已培训人员</el-radio-button>
            </el-radio-group>
            <el-form-item label="" prop="team">
              <el-select v-model="filters.team" placeholder="请选择" style="width:110px" v-if="!deptId&&userType!==2">
              <!-- <el-select v-model="filters.team" placeholder="请选择" style="width:110px"> -->
                <el-option label="全部" :value="null"></el-option>
                <el-option v-for="(item, index) in teams" :key="'team'+index" :label="item" :value="index+1"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="" prop="unitName">
              <el-input v-model="filters.unitName" style="width:150px;" placeholder="单位名称"></el-input>
            </el-form-item>
            <el-form-item label="" prop="key1">
              <el-input v-model="filters.key1" style="width:170px;" placeholder="姓名/身份证号"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="searchPrj">查询</el-button>
              <el-button @click="resetFilters">重置</el-button>
            </el-form-item>

            <el-form-item>
              <el-checkbox @change="changeHeight" v-model="showMore" style="width:60px">更多条件</el-checkbox>
              <el-checkbox v-if="type==='filed'&&viewtype===2&&inRoles('ROLE_training')" v-model="showSelect" style="width:60px">选择人员</el-checkbox>
            </el-form-item>
          </div>
        </el-form>
      </div>
    </section>
    <section class="wboxd" :style="type==='filed'?'margin-top:10px':'width:auto;border:0;margin-top:10px'">
      <el-table :height="tableHeight" :data="personList" highlight-current-row v-loading="listLoading" style="width: 100%;border-right:1px solid #74A6CC" border :row-key="getRowKeys" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
        @selection-change="handleSelectionChange"
        ref="multipleTable">
        <el-table-column type="selection" :selectable="canSelect" key="selection" v-if="viewtype===2&&showSelect" :reserve-selection="true" >
        </el-table-column>
        <el-table-column prop="pindex" label="序号" width="60" align="left">
          <template slot-scope="scope">
            <span :style="(scope.row.children&&scope.row.children.length>0)?'padding:10px 0;font-weight:bolder;color:blur':'padding:10px 0;'">{{scope.row.pindex}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位" min-width="90">
          <template slot-scope="scope">
            {{scope.row.unitName?scope.row.unitName:(scope.row.a0101?'未知单位':'')}}
          </template>
        </el-table-column>
        <el-table-column prop="a0184" label="姓名" width="90">
          <template slot-scope="scope">
            <template v-if="scope.row.a0000">
              <span v-if="scope.row.a0101" @click="detail(scope.row.a0184)" style="cursor:pointer;color:#0058AC;font-weight:bolder">{{scope.row.a0101}}</span>
            </template>
            <template v-else>
              <span v-if="scope.row.a0101">{{scope.row.a0101}}</span>
            </template>
          </template>
        </el-table-column>
        <el-table-column prop="age" label="年龄" width="40" align="center">
          <template slot-scope="scope">
            {{scope.row.age}}
          </template>
        </el-table-column>
        <el-table-column prop="a0104" label="性别" width="40" align="center">
          <template slot-scope="scope">
            {{scope.row.a0104}}
          </template>
        </el-table-column>
        <el-table-column prop="a0192" label="职务" width="160" align="center">
        </el-table-column>
        <el-table-column prop="a0221" label="级别" width="100" align="center">
        </el-table-column>
        <el-table-column prop="partyMember" label="是否党员" width="50" align="center">
          <template slot-scope="scope" >
            <template v-if="scope.row.a0101">
              {{isPartyMemberText(scope.row.a0141)}}
            </template>
          </template>
        </el-table-column>
        <el-table-column prop="times" label="培训次数" width="50" align="center">
          <template slot-scope="scope">
            <template v-if="scope.row.a0101">{{scope.row.children?scope.row.children.length:0}}</template>
          </template>
        </el-table-column>
        <el-table-column prop="year" label="最近参训年份" width="70" align="center">
          <template slot-scope="scope">
            <!-- <template v-if="scope.row.a0101">{{scope.row.trainingDate?dateFtt('yyyy',scope.row.trainingDate):''}}</template> -->
            <!-- {{scope.row.trainingYear}} -->
            <template v-if="scope.row.a0101">{{scope.row.trainingYear}}</template>
          </template>
        </el-table-column>
        <el-table-column prop="a0192x" label="任相当层次职务职级时间" width="130" align="center">
          <template slot-scope="scope">
            <template>
              {{showJobDate(scope.row)}}
              <el-button size="small" v-if="canEdit&&scope.row.jobDateFlag" @click="jobDateEdit(scope.row)" type="text" icon="el-icon-edit" />
            </template>
          </template>
        </el-table-column>
        <el-table-column prop="a0288" label="任现职务层次时间" width="100" align="center">
          <template slot-scope="scope">
            {{formatJobDate(scope.row.a0288)}}
          </template>
        </el-table-column>
        <el-table-column prop="a0192c" label="任现职级时间" width="100" align="center">
          <template slot-scope="scope">
            {{formatJobDate(scope.row.a0192c)}}
          </template>
        </el-table-column>
        <el-table-column prop="trainingDate" label="参训时间" width="190" align="center">
          <template slot-scope="scope">
            {{scope.row.trainingDate?(scope.row.trainingDate+'至'+(scope.row.trainingEndDate?scope.row.trainingEndDate:scope.row.trainingDate)):scope.row.trainingDateRemark}}
          </template>
        </el-table-column>
        <el-table-column prop="duration" label="培训时长" width="80" align="center">
          <template slot-scope="scope">
            {{scope.row.duration?scope.row.duration+'天':''}}
          </template>
        </el-table-column>
        <el-table-column prop="place" label="参训地点" width="120">
        </el-table-column>
        <!-- <el-table-column prop="trainUnit" label="举办单位" width="120" align="center">
        </el-table-column> -->
        <el-table-column prop="className" label="班次名称" width="120">
        </el-table-column>
        <el-table-column label="操作" width="160" v-if="type==='recommended'">
          <template slot-scope="scope">
            <template v-if="scope.row.a0101">
              <el-button type="success" size="small" @click="addToCandidate(scope.row)" :loading="addLoading" style="margin:10px 0">选为建议人选</el-button>
            </template>
            <template v-else>
              <el-button size="small" @click="handleDetail(scope.row.id)" style="margin:10px 0 10px 0">查看</el-button>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="270" v-if="type==='official'">
          <template slot-scope="scope">
            <template v-if="scope.row.a0101">
              <el-button type="success" size="small" @click="addToCandidate(scope.row,1)" :loading="addLoading" style="margin:10px 0">选为参训人选</el-button><br>
              <el-button type="primary" size="small" @click="addToCandidate(scope.row,2)" :loading="addLoading" style="margin:10px 0">选为备选人选</el-button>
            </template>
            <template v-else>
              <el-button size="small" @click="handleDetail(scope.row.id)" style="margin:10px 0 10px 0">查看</el-button>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="240" v-if="type==='filed'">
          <template slot-scope="scope">
            <template v-if="scope.row.a0101">
              <el-button size="small" v-if="canEdit" @click="handleAdd(scope.row)" type="success" :loading="btnLoading" style="margin:10px 0 10px 0">新增培训</el-button>
              <el-button size="small" v-if="!canEdit&&scope.row.filedId"  @click="handleDetail(scope.row.filedId)" style="margin:10px 0 10px 0">查看</el-button>
              <!-- <el-button size="small" v-if="viewtype===2&&inRoles('ROLE_training')&&!exportSelected(scope.row)" @click="addExport(scope.row)" :loading="btnLoading" style="margin:10px 0 10px 0">加入导出列表</el-button>
              <el-button size="small" v-if="viewtype===2&&inRoles('ROLE_training')&&exportSelected(scope.row)" @click="removeExport(scope.row)" type="danger" :loading="btnLoading" style="margin:10px 0 10px 0">移出导出列表</el-button> -->
            </template>
            <template v-else>
              <el-button size="small" v-if="canEdit" @click="handleEdit(scope.row.id)" type="primary" style="margin:10px 0 10px 0">修改</el-button>
              <el-button type="danger" v-if="canEdit" size="small" @click="handleDel(scope.row.id)" :loading="btnLoading" style="margin:10px 0">删除</el-button>
              <el-button size="small" v-if="!canEdit"  @click="handleDetail(scope.row.id)" style="margin:10px 0 10px 0">查看</el-button>
            </template>
          </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination style="float:right" :total="totalnum" :page-size="pageSize" @current-change="handleCurrentChange" :current-page="pageNum" @size-change="handleSizeChange" :page-sizes="[50,100,200,300]" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
      </div>
    </section>
  </div>
</template>

<script>
// import qs from 'qs'
import classDetail from './classDetail.vue'
import personInfo from '@/person/Detail.vue'
import additionalPerson from './additionalPerson.vue'
// import additionalPersonDetail from './additionalPersonDetail.vue'
export default {
  components: {
    personInfo,
    classDetail,
    additionalPerson
    // additionalPersonDetail
  },
  watch: {
    filterText (val) {
      this.$refs.tree.filter(val)
    },
    deptId: {
      handler (val) {
        if (val) {
          if (this.type !== 'filed') {
            this.viewtype = 2
            this.getList()
          }
        }
      },
      immediate: true
    },
    type: {
      handler (val) {
        if (val !== 'filed') {
          this.viewtype = 2
          this.getList()
        }
      },
      immediate: true
    }
  },
  props: {
    tableHeight: null,
    type: null,
    deptId: null,
    classId: null,
    canEdit: false
  },
  data () {
    return {
      filterText: '',
      selectAllBtn: true,
      personForm: {
        unitName: '',
        realName: '',
        idCardNo: ''
      },
      personVisible: false,
      jobDateRemoveVisible: false,
      jobDateFormVisible: false,
      jobDateForm: {
        jobDate: null,
        a0000: null,
        name: ''
      },
      jobDateFormRules: {
        jobDate: [
          { required: true, message: '必填项', trigger: 'blur' }
        ]
      },
      showMore: false,
      showSelect: false,
      levelList: [
        '厅局级正职',
        '厅局级副职',
        '三级职员',
        '四级职员',
        '县处级正职',
        '县处级副职',
        '乡科级正职',
        '乡科级副职',
        '试用期人员'
      ],
      exportType: 1,
      getRowKeys (row) {
        return row.id
      },
      ids: [],
      additionalPersonListVisible: false,
      timestamp: new Date(),
      userTeam: null,
      dateType: 1,
      personDetailVisible: false,
      personId: null,
      showManage: false,
      exportVisible: false,
      exportForm: {
        year: null,
        team: null
      },
      exportVisibleAll: false,
      exportAllForm: {
        unitId: null
      },
      units: [],
      btnLoading: false,
      addFormTitle: '新增',
      loading: false,
      userType: null,
      showClassId: null,
      totalnum: 0,
      viewtype: 2,
      personList: [
      ],
      filters: {
        team: null,
        unitName: '',
        key1: '',
        jobNotContain: null,
        job: '',
        trainUnit: '',
        className: '',
        ageFrom: undefined,
        ageTo: undefined,
        partyMember: null,
        trainingYear: null,
        markYear: undefined,
        markYear2: undefined,
        levels: [],
        durationStart: undefined,
        durationEnd: undefined,
        durationNotContain: null,
        classNameNotContain: null,
        trainUnitNotContain: null,
        levelsNotContain: null,
        placeNotContain: null,
        place: '',
        placeNotContrain: null,
        trained: null,
        jobDateNotContain: null,
        jobDateStart: undefined,
        jobDateEnd: undefined,
        a0288NotContain: null,
        a0288Start: undefined,
        a0288End: undefined,
        a0192cNotContain: null,
        a0192cStart: undefined,
        a0192cEnd: undefined,
        a0104: null
      },
      saveLoading: false,
      teams: ['机关司局', '直属单位', '派出机构'],
      yearlist: [],
      listLoading: false,
      pageNum: 1,
      pageSize: 50,
      changeSizeFlag: false,
      addLoading: false,
      classVisible: false,
      addFormVisible: false,
      addForm: {
        unitName: '',
        name: '',
        idCardNo: '',
        age: '',
        job: '',
        level: '',
        partyMember: '',
        jobDate: '',
        trainingDate: [],
        duration: null,
        trainingDateRemark: '',
        trainingYear: '',
        trainUnit: '',
        className: '',
        place: ''
      },
      addFormRules: {
        jobDate: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        // trainUnit: [
        //   { required: true, message: '必填项', trigger: 'blur' }
        // ],
        className: [
          { required: true, message: '必填项', trigger: 'blur' }
        ],
        place: [
          { required: true, message: '必填项', trigger: 'blur' }
        ]
      },
      jobDate: '',
      A0192X: ''
    }
  },
  methods: {
    selectTree (flag) {
      if (this.$refs.tree) {
        if (flag) {
          this.selectAllBtn = false
          const keys = []
          for (let i = 0; i < this.units.length; i++) {
            keys.push(this.units[i].id)
          }
          console.log(keys)
          this.$refs.tree.setCheckedKeys(keys)
        } else {
          this.selectAllBtn = true
          this.$refs.tree.setCheckedKeys([])
          var nodes = this.$refs.tree.store.nodesMap
          for (var i in nodes) {
            nodes[i].expanded = false
          }
        }
      }
    },
    filterNode (value, data) {
      if (!value) return true
      return data.label.indexOf(value) !== -1
    },
    exportAllDataByUnit () {
      if (this.$refs.tree.getCheckedKeys().filter(item => item < 1000).length === 0) {
        this.$message({
          message: '至少选择一家单位',
          type: 'error'
        })
      } else {
        window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportAll?unitIdStr=' + this.$refs.tree.getCheckedKeys().filter(item => item < 1000).join(','))
      }
      // if (this.exportAllForm.unitId === null) {
      //   window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportAll')
      // } else {
      //   window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportAll?unitId=' + this.exportAllForm.unitId)
      // }
    },
    handleExportAllShow () {
      this.exportAllForm.unitId = null
      this.exportVisibleAll = true
    },
    searchPerson () {
      this.personForm.realName = ''
      this.personForm.unitName = ''
      this.personForm.idCardNo = ''
      this.personVisible = true
    },
    exportPersonData () {
      if (!this.personForm.realName && !this.personForm.unitName && !this.personForm.idCardNo) {
        this.$message({
          message: '至少填写一个查询条件',
          type: 'error'
        })
        return false
      }
      var form = document.createElement('form')
      form.setAttribute('method', 'post')
      form.setAttribute('target', '_blank')
      if (this.personForm.realName) {
        var input = document.createElement('input')
        input.setAttribute('type', 'hidden')
        input.setAttribute('name', 'name')
        input.setAttribute('value', this.personForm.realName)
        form.append(input)
      }
      if (this.personForm.unitName) {
        var input1 = document.createElement('input')
        input1.setAttribute('type', 'hidden')
        input1.setAttribute('name', 'unitName')
        input1.setAttribute('value', this.personForm.unitName)
        form.append(input1)
      }
      if (this.personForm.idCardNo) {
        var input2 = document.createElement('input')
        input2.setAttribute('type', 'hidden')
        input2.setAttribute('name', 'idCardNo')
        input2.setAttribute('value', this.personForm.idCardNo)
        form.append(input2)
      }
      form.setAttribute('action', this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportSearchPerson')
      document.body.appendChild(form)
      form.submit()
      form.remove()
    },
    submitJobDateForm () {
      this.$refs.jobDateForm.validate((valid) => {
        if (valid) {
          if (!this.isDate8(this.jobDateForm.jobDate) && !this.isDate6(this.jobDateForm.jobDate) && this.jobDateForm.jobDate) {
            this.$message({
              message: '任相当层次职务职级时间保存失败：格式有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          let para = {a0000: this.jobDateForm.a0000, jobDate: this.jobDateForm.jobDate}
          this.addLoading = true
          this.$http.post(this.$http.defaults.trainingAPI + `api/jobDateAppend/save`, para).then(response => {
            this.addLoading = false
            if (response.data.success === true) {
              this.$message({
                message: '修改成功',
                type: 'success'
              })
              this.jobDateFormVisible = false
              this.getList()
            } else {
              this.$message({
                message: '修改失败:' + response.data.message,
                type: 'error'
              })
            }
          })
        }
      })
    },
    removeJobDate () {
      this.$confirm('确认删除' + this.jobDateForm.name + '的任相当层次职务职级时间吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.addLoading = true
        let para = {ids: [this.jobDateForm.a0000]}
        this.$http.post(this.$http.defaults.trainingAPI + `api/jobDateAppend/remove`, para).then(response => {
          this.addLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.jobDateFormVisible = false
            this.getList()
          } else {
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
      })
    },
    jobDateEdit (data) {
      this.jobDateForm.jobDate = data.a0192x
      this.jobDateForm.a0000 = data.a0000
      this.jobDateForm.name = data.a0101
      this.jobDateFormVisible = true
      this.jobDateRemoveVisible = !!data.a0192x
    },
    resetFilters () {
      console.log('resetForm')
      this.$refs['filtersForm'].resetFields()
    },
    changeHeight () {
      this.$emit('changeHeight')
    },
    showJobDate (row) {
      // let jobDate = row.jobDate
      // if (row.jobDate && row.a0192X) {
      //   jobDate = row.jobDate > row.a0192X ? row.jobDate : row.a0192X
      // } else {
      //   if (row.a0192X) {
      //     jobDate = row.a0192X
      //   }
      // }
      let jobDate = row.a0192x
      if (!jobDate) {
        jobDate = row.a0192X
      }
      // if (!jobDate) {
      //   jobDate = row.jobDate
      // }
      return this.formatJobDate(jobDate)
    },
    getByA0000 (id) {
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getByA0000?a0000=` + id)
        .then(response => {
          if (response.data.success) {
            if (response.data.result) {
              this.A0192X = response.data.result
            }
          }
        })
    },
    getJobDateByIdCardNo (idCardNo) {
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getJobDateByIdCardNo?idCardNo=` + idCardNo)
        .then(response => {
          if (response.data.success) {
            if (response.data.result) {
              this.jobDate = response.data.result
            }
          }
        })
    },
    exportSelected (row) {
      return this.ids.includes(row)
    },
    addExport (row) {
      let ids = this.ids
      ids.push(row)
      this.$refs.multipleTable.clearSelection()
      ids.forEach(item => {
        this.$refs.multipleTable.toggleRowSelection(item)
      })
    },
    removeExport (row) {
      let ids = this.ids.filter(item => item.id !== row.id)
      this.$refs.multipleTable.clearSelection()
      ids.forEach(item => {
        this.$refs.multipleTable.toggleRowSelection(item)
      })
    },
    canSelect (row) {
      return !!row.realName
    },
    handleSelectionChange (val) {
      this.ids = val
    },
    formatJobDate (str) {
      if (str) {
        if (str.length === 6 && /^[0-9]*$/.test(str)) { // yyyymm
          return str.substr(0, 4) + '.' + str.substr(4)
        }
        if (str.length === 8 && /^[0-9]*$/.test(str)) { // yyyymmdd
          return str.substr(0, 4) + '.' + str.substr(4, 2) + '.' + str.substr(6, 2)
        } else {
          return str
        }
      }
    },
    refreshRecommented () {
      this.viewtype = 1
      this.getList()
    },
    showAdditional () {
      this.timestamp = new Date()
      this.additionalPersonListVisible = true
    },
    // additionalPerson () {},
    GetNumberOfDays (date1, date2) { // 获得天数
    // date1：开始日期，date2结束日期
      var a1 = Date.parse(new Date(date1))
      var a2 = Date.parse(new Date(date2))
      var day = parseInt((a2 - a1) / (1000 * 60 * 60 * 24))// 核心：时间戳相减，然后除以天数
      return day
    },
    setDuration () {
      console.log(this.addForm.trainingDate[0])
      console.log(this.addForm.trainingDate[1])
      console.log(this.GetNumberOfDays(this.addForm.trainingDate[0], this.addForm.trainingDate[1]) + 1)
      this.addForm.duration = this.GetNumberOfDays(this.addForm.trainingDate[0], this.addForm.trainingDate[1]) + 1
    },
    rowStyle ({row, rowIndex}) {
      if (row.markYear) {
        return 'mark_class'
      }
      return ''
    },
    persondetail (id) {
      this.personDetailVisible = true
      this.personId = id
    },
    detail (idcardNo) {
      this.$http
        .get(this.$http.defaults.selectionAPI + `api/selection/jiben/getIdByIdCardNo?idcard=` + idcardNo)
        .then(response => {
          if (response.data.success) {
            if (response.data.result) {
              this.persondetail(response.data.result)
            } else {
              this.$message({
                message: '无此人选的干部全方位情况',
                type: 'error'
              })
            }
          } else {
            this.$message({
              message: '查询失败:无此人选的干部全方位情况',
              type: 'error'
            })
          }
        })
        .catch(() => {
          this.$message({
            message: '查询失败:无此人选的干部全方位情况',
            type: 'error'
          })
        })
    },
    exportData () {
      var form = document.createElement('form')
      form.setAttribute('method', 'post')
      form.setAttribute('target', '_blank')
      if (this.exportType === 1 && this.exportForm.team) {
        var input = document.createElement('input')
        input.setAttribute('type', 'hidden')
        input.setAttribute('name', 'team')
        input.setAttribute('value', this.exportForm.team)
        form.append(input)
      }
      if (this.exportForm.year) {
        input = document.createElement('input')
        input.setAttribute('type', 'hidden')
        input.setAttribute('name', 'year')
        input.setAttribute('value', this.exportForm.year)
        form.append(input)
      }
      if (this.exportType === 2) {
        input = document.createElement('input')
        input.setAttribute('type', 'hidden')
        input.setAttribute('name', 'ids')
        input.setAttribute('value', this.ids.map(item => item.a0000).join(','))
        form.append(input)
      }
      console.log(this.ids.map(item => item.a0000).join(','))
      form.setAttribute('action', this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExport')
      document.body.appendChild(form)
      form.submit()
      form.remove()

    //   let newWin = window.open('')
    //   let formStr = ''
    //   formStr = '<form style="visibility:hidden;" method="POST" action="' + this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExport">' +
    // '<input style="hidden" name="team" value="' + this.exportForm.team + '" />' +
    // '<input style="hidden" name="year" value="' + this.exportForm.year + '" />' +
    // '<input style="hidden" name="ids" value="' + this.ids.map(item => item.a0000).join(',') + '" />' +
    // '</form>'
    //   newWin.document.body.innerHTML = formStr
    //   newWin.document.forms[0].submit()
      // let para = {team: this.exportForm.team, year: this.exportForm.year}
      // window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExport?' + qs.stringify(para))
    },
    handleExport () {
      this.exportForm.year = null
      this.exportForm.team = null
      this.exportVisible = true
    },
    handleExportAll () {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportAll')
    },
    handleExportHidden () {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.trainingAPI + 'api/trainingBusFiledCandidate/getExportProblemPersons')
    },
    handleIndex () {
      this.$router.push({name: `Train`})
    },
    handleAuth () {
      this.$router.push({name: `trainAuth`})
    },
    handleChart () {
      this.$router.push({name: `trainChart`})
    },
    isDate8 (sDate) {
      if (!/^[0-9]{8}$/.test(sDate)) {
        return false
      }
      var year, month, day
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      day = sDate.substring(6, 8)
      var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      if (year < 1700 || year > 2500) return false
      if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) iaMonthDays[1] = 29
      if (month < 1 || month > 12) return false
      if (day < 1 || day > iaMonthDays[month - 1]) return false
      return true
    },
    isDate6 (sDate) {
      if (!/^[0-9]{6}$/.test(sDate)) {
        return false
      }
      var year, month
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      if (year < 1700 || year > 2500) return false
      if (month < 1 || month > 12) return false
      return true
    },
    submitForm () {
      this.$refs.addForm.validate((valid) => {
        if (valid) {
          console.log(this.addForm.jobDate)
          if (!this.isDate8(this.addForm.jobDate) && !this.isDate6(this.addForm.jobDate) && this.addForm.jobDate) {
            this.$message({
              message: '任相当层次职务职级时间保存失败：格式有误，格式：20201001或202010',
              type: 'error'
            })
            return false
          }
          let para = {
            id: this.addForm.id,
            name: this.addForm.name,
            idCardNo: this.addForm.idCardNo,
            jobDate: this.addForm.jobDate,
            trainingDate: this.dateType === 1 ? this.addForm.trainingDate[0] : '',
            trainingEndDate: this.dateType === 1 ? this.addForm.trainingDate[1] : '',
            duration: this.dateType === 1 ? this.addForm.duration : 0,
            trainingDateRemark: this.dateType === 2 ? this.addForm.trainingDateRemark : '',
            trainingYear: this.dateType === 2 ? parseInt(this.addForm.trainingYear) : (this.addForm.trainingDate ? this.dateFtt('yyyy', this.addForm.trainingDate[0]) : ''),
            trainUnit: this.addForm.trainUnit,
            className: this.addForm.className,
            place: this.addForm.place
          }
          if (this.dateType === 2 && (!this.addForm.trainingDateRemark || !this.addForm.trainingYear)) {
            this.$message({
              message: '参训日期不明确时请填写参训日期描述和参训年份',
              type: 'error'
            })
            return false
          }
          if (this.dateType === 1 && (!this.addForm.trainingDate || this.addForm.trainingDate.length === 0)) {
            this.$message({
              message: '请填写参训日期',
              type: 'error'
            })
            return false
          }
          this.addLoading = true
          this.$http.post(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/save`, para).then(response => {
            console.log(response.data.success)
            this.addLoading = false
            if (response.data.success === true) {
              this.$message({
                message: '保存成功',
                type: 'success'
              })
              this.addFormVisible = false
              this.getList()
            } else {
              console.log('保存失败:' + response.data.message)
              this.$message({
                message: '保存失败:' + response.data.message,
                type: 'error'
              })
            }
          }).catch((error) => {
            console.log(error)
            this.$message({
              message: '网络保存失败:' + error,
              type: 'error'
            })
            this.addLoading = false
          })
        }
      })
    },
    handleDel (id) {
      this.$confirm('确认删除该培训记录吗?', '提示', {
        type: 'warning'
      }).then(() => {
        this.btnLoading = true
        let para = {ids: [id]}
        this.listLoading = true
        this.$http.post(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/remove`, para).then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.getList()
          } else {
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
      })
    },
    handleEdit (id) {
      this.loading = true
      this.addFormVisible = true
      this.addFormTitle = '修改'
      this.A0192X = ''
      this.addForm.jobDate = ''
      this.addForm.a0288 = ''
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getById?id=` + id)
        .then(response => {
          this.loading = false
          if (response.data.success === true) {
            this.addForm.name = response.data.result.name
            this.addForm.idCardNo = response.data.result.idCardNo
            this.addForm.trainingDate = [response.data.result.trainingDate, response.data.result.trainingEndDate ? response.data.result.trainingEndDate : response.data.result.trainingDate]
            this.addForm.trainingDateRemark = response.data.result.trainingDateRemark
            this.addForm.trainingYear = response.data.result.trainingYear ? response.data.result.trainingYear.toString() : ''
            this.addForm.trainUnit = response.data.result.trainUnit
            this.addForm.className = response.data.result.className
            this.addForm.place = response.data.result.place
            this.addForm.id = response.data.result.id
            this.dateType = this.addForm.trainingDate && this.addForm.trainingDate.length > 0 && this.addForm.trainingDate[0] ? 1 : 2
            this.addForm.duration = ''
            if (this.addForm.trainingDate && this.addForm.trainingDate.length > 0 && this.addForm.trainingDate[0]) {
              this.setDuration()
            }
            this.$http
              .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getPersonInfo?idCardNo=` + this.addForm.idCardNo)
              .then(response => {
                this.loading = false
                if (response.data.success === true) {
                  if (response.data.result) {
                    this.addForm.unitName = response.data.result.unitName
                    this.addForm.level = response.data.result.a0221
                    this.addForm.age = response.data.result.age
                    this.addForm.job = response.data.result.a0192
                    this.addForm.partyMember = response.data.result.partyMember ? '是' : '否'
                    this.addForm.jobDate = response.data.result.a0192x
                    this.addForm.a0288 = response.data.result.a0288
                  } else {
                    this.addForm.unitName = ''
                    this.addForm.level = ''
                    this.addForm.job = ''
                    this.addForm.age = ''
                    this.addForm.partyMember = ''
                    this.addForm.jobDate = ''
                    this.addForm.a0288 = ''
                  }
                }
              })
              .catch(error => {
                this.loading = false
                console.log(error)
                this.$message({
                  message: '获取失败:' + error,
                  type: 'error'
                })
              })
          }
        })
        .catch(error => {
          this.loading = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
    },
    handleDetail (id) {
      this.loading = true
      this.addFormVisible = true
      this.addFormTitle = '查看'
      this.A0192X = ''
      this.addForm.jobDate = ''
      this.addForm.a0288 = ''
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getById?id=` + id)
        .then(response => {
          this.loading = false
          if (response.data.success === true) {
            this.addForm.unitName = response.data.result.unitName
            this.addForm.name = response.data.result.name
            this.addForm.idCardNo = response.data.result.idCardNo
            this.addForm.age = response.data.result.age
            this.addForm.job = response.data.result.a0192
            this.addForm.level = response.data.result.a0221
            if (response.data.result.a0141) {
              this.addForm.partyMember = response.data.result.partyMember ? '是' : '否'
            } else {
              this.addForm.partyMember = ''
            }
            this.addForm.jobDate = response.data.result.jobDate
            this.addForm.a0288 = response.data.result.a0288
            this.addForm.trainingDate = [response.data.result.trainingDate, response.data.result.trainingEndDate ? response.data.result.trainingEndDate : response.data.result.trainingDate]
            this.addForm.trainingDateRemark = response.data.result.trainingDateRemark
            this.addForm.trainingYear = response.data.result.trainingYear ? response.data.result.trainingYear.toString() : ''
            this.addForm.trainUnit = response.data.result.trainUnit
            this.addForm.className = response.data.result.className
            this.addForm.place = response.data.result.place
            this.addForm.id = response.data.result.id
            this.dateType = this.addForm.trainingDate && this.addForm.trainingDate.length > 0 && this.addForm.trainingDate[0] ? 1 : 2
            this.addForm.duration = ''
            console.log('this.addForm.trainingDate')
            console.log(this.addForm.trainingDate)
            if (this.addForm.trainingDate && this.addForm.trainingDate.length > 0 && this.addForm.trainingDate[0]) {
              this.setDuration()
            }
            this.$http
              .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getPersonInfo?idCardNo=` + this.addForm.idCardNo)
              .then(response => {
                this.loading = false
                if (response.data.success === true) {
                  if (response.data.result) {
                    this.addForm.unitName = response.data.result.unitName
                    this.addForm.level = response.data.result.a0221
                    this.addForm.age = response.data.result.age
                    this.addForm.job = response.data.result.a0192
                    this.addForm.partyMember = response.data.result.partyMember ? '是' : '否'
                    this.addForm.jobDate = response.data.result.a0192x
                    this.addForm.a0288 = response.data.result.a0288
                  } else {
                    this.addForm.unitName = ''
                    this.addForm.level = ''
                    this.addForm.job = ''
                    this.addForm.age = ''
                    this.addForm.partyMember = ''
                    this.addForm.jobDate = ''
                    this.addForm.a0288 = ''
                  }
                }
              })
              .catch(error => {
                this.loading = false
                console.log(error)
                this.$message({
                  message: '获取失败:' + error,
                  type: 'error'
                })
              })
          }
        })
        .catch(error => {
          this.loading = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
    },
    handleAdd (data) {
      console.log(data)
      this.loading = true
      this.addFormVisible = true
      this.addFormTitle = '新增'
      this.addForm.unitName = data.unitName
      this.addForm.name = data.a0101
      this.addForm.idCardNo = data.a0184
      this.addForm.age = data.age
      this.addForm.level = data.a0221
      // this.addForm.jobDate = data.jobDate
      this.addForm.jobDate = data.a0192x ? data.a0192x : (data.a0192X ? data.a0192X : data.jobDate)
      this.addForm.a0288 = data.a0288
      this.addForm.trainingDate = []
      this.addForm.trainingDateRemark = null
      this.addForm.duration = null
      this.addForm.trainingYear = null
      this.addForm.trainUnit = null
      this.addForm.className = null
      this.addForm.place = null
      this.addForm.id = null
      this.dateType = 1
      this.A0192X = ''
      this.addForm.jobDate = ''
      this.addForm.a0288 = ''
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getPersonInfo?idCardNo=` + data.a0184)
        .then(response => {
          this.loading = false
          if (response.data.success === true) {
            this.addForm.unitName = data.unitName
            this.addForm.idCardNo = data.a0184
            this.addForm.level = data.a0221
            if (response.data.result) {
              this.addForm.job = response.data.result.a0192
              this.addForm.partyMember = response.data.result.partyMember ? '是' : '否'
              this.addForm.jobDate = response.data.result.a0192x
              this.addForm.a0288 = response.data.result.a0288
            } else {
              this.addForm.job = ''
              this.addForm.partyMember = ''
            }
            this.addForm.trainingDate = []
            this.addForm.trainingDateRemark = null
            this.addForm.duration = null
            this.addForm.trainingYear = null
            this.addForm.trainUnit = null
            this.addForm.className = null
            this.addForm.place = null
            this.addForm.id = null
            console.log('this.addForm.job')
            console.log(this.addForm.job)
            // this.getJobDateByIdCardNo(this.addForm.idCardNo)
            // if (response.data.result && response.data.result.a0000) {
            //   this.getByA0000(response.data.result.a0000)
            // }
          }
        })
        .catch(error => {
          this.loading = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
    },
    handleAddAdditional (data) {
      this.additionalPersonListVisible = false
      console.log('测试跨组件参数传递')
      console.log(data)
      // this.addFormVisible = true
      this.addFormTitle = '新增'
      this.addForm.unitName = data.unit
      this.addForm.name = data.name
      this.addForm.idCardNo = data.idCardNo
      this.addForm.age = data.age
      this.addForm.level = data.level
      this.addForm.jobDate = data.jobDate
      this.addForm.a0288 = data.a0288
      this.addForm.partyMember = data.partyMember ? '是' : '否'
      this.addForm.job = data.job
      this.addForm.trainingDate = []
      this.addForm.trainingDateRemark = null
      this.addForm.duration = null
      this.addForm.trainingYear = null
      this.addForm.trainUnit = null
      this.addForm.className = null
      this.addForm.place = null
      this.addForm.id = null
      this.dateType = 1
    },
    // getAuth () {
    //   this.$http
    //     .get(this.$http.defaults.trainingAPI + `api/trainingBusAuth/getCurrentUserAuth`)
    //     .then(response => {
    //       if (response.data.success === true) {
    //         console.log('获取成功')
    //         if (this.userType === 1) {
    //           this.canEdit = true
    //         } else if (this.userType === 2) {
    //           this.canEdit = (response.data.result === 2)
    //         } else {
    //           this.canEdit = false
    //         }
    //       } else {
    //         console.log('获取失败:' + response.data.message)
    //         this.$message({
    //           message: '获取失败:' + response.data.message,
    //           type: 'error'
    //         })
    //       }
    //     })
    //     .catch((error) =>  {
    //       console.log(error)
    //       this.$message({
    //         message: '获取失败:' + error,
    //         type: 'error'
    //       })
    //     })
    // },
    showClass (id) {
      this.showClassId = id
      this.classVisible = true
    },
    isPartyMemberText (text) {
      if (text || text === '') {
        if (text === '中共党员' || text === '预备党员') {
          return '是'
        } else {
          return '否'
        }
      } else {
        return ''
      }
    },
    isPartyMember (text) {
      if (text || text === '') {
        if (text === '中共党员' || text === '预备党员') {
          return 1
        } else {
          return 0
        }
      } else {
        return ''
      }
    },
    handleSizeChange (val) {
      this.pageNum = 1
      this.pageSize = val
      this.getList()
    },
    handleCurrentChange (val) {
      this.pageNum = val
      this.getList()
    },
    getYearList () {
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusFiledCandidate/getAllYears`)
        .then(response => {
          if (response.data.success === true) {
            this.yearlist = response.data.result
          }
        })
        .catch((error) => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    getAllUnitList () {
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusUnit/getAllList`)
        .then(response => {
          if (response.data.success === true) {
            this.units = response.data.result
          }
        })
        .catch((error) => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    addToCandidate (data, type) {
      this.addLoading = true
      this.$http
        .get(this.$http.defaults.trainingAPI + `api/trainingBusClass/getById?id=` + this.classId)
        .then(response => {
          if (response.data.success === true) {
            let tableName = 'trainingBusRecommendedCandidate'
            if (type) {
              tableName = 'trainingBusOfficialCandidate'
            }
            let batchId = response.data.result.batchId
            let personNumber = response.data.result.personNumber
            let para = {
              batchId: batchId,
              classId: this.classId,
              deptId: this.deptId,
              name: data.a0101,
              idCardNo: data.a0184,
              age: data.age,
              unit: data.unitName,
              job: data.a0192,
              level: data.a0221,
              partyMember: this.isPartyMember(data.a0141),
              jobDate: data.a0192x ? data.a0192x : (data.a0192X ? data.jobDate : ''),
              selected: false
            }
            if (type) {
              para.type = type
              para.participation = (type === 1 ? 1 : 0)
            }
            if (type === 1) {
              this.$http
                .get(this.$http.defaults.trainingAPI + `api/trainingBusClass/getOfficialCandidateList?classId=` + this.classId)
                .then(response => {
                  if (response.data.success === true) {
                    let officialNum = response.data.result.filter(item => item.type === 1 && item.participation).length
                    if (officialNum < personNumber) {
                      this.addToCandidateSubmit(para, tableName)
                    } else {
                      this.$confirm('该班次培训人数为' + personNumber + '人，已添加参训人员' + officialNum + '人，是否继续添加？', '提示', {
                        type: 'warning'
                      }).then(() => {
                        this.addToCandidateSubmit(para, tableName)
                      }).catch(() => {
                        this.addLoading = false
                      })
                    }
                  } else {
                    this.addLoading = false
                    console.log('获取失败:' + response.data.message)
                    this.$message({
                      message: '获取失败:' + response.data.message,
                      type: 'error'
                    })
                  }
                })
                .catch((error) => {
                  this.addLoading = false
                  console.log(error)
                  this.$message({
                    message: '网络获取失败:' + error,
                    type: 'error'
                  })
                })
            } else {
              this.addToCandidateSubmit(para, tableName)
            }
          } else {
            this.addLoading = false
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          this.addLoading = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
    },
    addToCandidateSubmit (para, tableName) {
      this.$http.post(this.$http.defaults.trainingAPI + `api/` + tableName + `/save`, para).then(response => {
        console.log(response.data.success)
        this.addLoading = false
        if (response.data.success === true) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.$emit('refreshRecommented')
        } else {
          console.log('操作失败:' + response.data.message)
          this.$message({
            message: '操作失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.$message({
          message: '保存失败:' + error,
          type: 'error'
        })
        this.addLoading = false
      })
    },
    changeViewType () {
      this.exportType = 1
      this.searchPrj()
    },
    searchPrj () {
      this.pageNum = 1
      this.getList()
    },
    searchList () {},
    addPerson () {
      this.activeName = 'search'
    },
    moveData () {},
    // handleEditPerson () {
    //   if (this.type === 'recommended') {
    //     this.personVisible = true
    //   } else if (this.type === 'official') {
    //     this.personVisible1 = true
    //   }
    // },
    getList () {
      console.log('this.userType')
      console.log(this.userType)
      console.log('this.deptId')
      console.log(this.deptId)
      this.listLoading = true
      let team = null
      // if (this.userType === 2) {
      //   team = this.userTeam
      // } else {
      if (this.deptId) {
        team = this.deptId
      } else {
        team = this.filters.team
      }
      // }
      let para = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        trained: this.viewtype === 1 ? null : this.filters.trained,
        team: team,
        unitName: this.filters.unitName,
        key1: this.filters.key1,
        partyMember: this.filters.partyMember,
        trainingYear: this.filters.trainingYear,
        markYear: this.filters.markYear,
        markYear2: this.filters.markYear2,
        levels: this.filters.levels,
        a0104: this.filters.a0104
      }
      para.className = this.filters.className
      para.classNameNotContain = this.filters.className ? this.filters.classNameNotContain : null
      para.trainUnit = this.filters.trainUnit
      para.trainUnitNotContain = this.filters.trainUnit ? this.filters.trainUnitNotContain : null
      para.levelsNotContain = this.filters.levels ? this.filters.levelsNotContain : null
      para.job = this.filters.job
      para.jobNotContain = this.filters.job ? this.filters.jobNotContain : null
      para.place = this.filters.place
      para.placeNotContain = this.filters.place ? this.filters.placeNotContain : null
      if (!this.filters.ageFrom && !this.filters.ageTo) {
        para.ageFrom = null
        para.ageTo = null
      } else {
        para.ageFrom = this.filters.ageFrom ? this.filters.ageFrom : 0
        para.ageTo = this.filters.ageTo ? this.filters.ageTo : 1000
      }
      if (!this.filters.durationStart && !this.filters.durationEnd) {
        para.durationStart = null
        para.durationEnd = null
      } else {
        para.durationStart = this.filters.durationStart ? this.filters.durationStart : 0
        para.durationEnd = this.filters.durationEnd ? this.filters.durationEnd : 1000
        para.durationNotContain = this.filters.durationNotContain
      }
      para.jobDateStart = this.filters.jobDateStart ? this.filters.jobDateStart : null
      para.jobDateEnd = this.filters.jobDateEnd ? (this.filters.jobDateEnd + '31') : null
      if (this.filters.jobDateStart || this.filters.jobDateEnd) {
        para.jobDateNotContain = this.filters.jobDateNotContain
      }
      para.a0288Start = this.filters.a0288Start ? this.filters.a0288Start : null
      para.a0288End = this.filters.a0288End ? (this.filters.a0288End + '31') : null
      if (this.filters.a0288Start || this.filters.a0288End) {
        para.a0288NotContain = this.filters.a0288NotContain
      }
      para.a0192cStart = this.filters.a0192cStart ? this.filters.a0192cStart : null
      para.a0192cEnd = this.filters.a0192cEnd ? (this.filters.a0192cEnd + '31') : null
      if (this.filters.a0192cStart || this.filters.a0192cEnd) {
        para.a0192cNotContain = this.filters.a0192cNotContain
      }
      let url = 'api/trainingBusFiledCandidate/queryBaseDataByPage'
      if (this.viewtype === 1) {
        url = 'api/trainingBusFiledCandidate/queryBaseDataByPage2'
      }
      this.$http
        .post(this.$http.defaults.trainingAPI + url, para)
        .then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            console.log('获取成功')
            this.personList = response.data.result.records

            if (this.viewtype === 2) {
              this.personList.forEach((item, index, arr) => {
                arr[index].a0101 = item.realName
                // if (!item.a0101) {
                //   arr[index].a0101 = item.name
                // }
              })
            }
            let allindex = 0
            this.personList.forEach((item, index, arr) => {
              arr[index].pindex = index + 1
              arr[index].allindex = 'p_' + allindex
              allindex++
              // if (!item.id) {
              //   arr[index].id = 'p_' + item.filedId
              // }
              if (item.filedId) {
                arr[index].id = 'p_f' + item.filedId
              } else {
                arr[index].id = 'p_p' + item.id
              }
              if (item.children && item.children.length > 0) {
                item.children.forEach((it, idx, myarr) => {
                  myarr[idx].allindex = 'c_' + allindex
                  allindex++
                })
              }
            })
            this.totalnum = response.data.result.total
            console.log(this.personList.map(item => item.a0184))
            this.ids = this.$refs.multipleTable.selection
            let repeatNum = ''
            this.personList.forEach(item => {
              if (this.personList.filter(it => it.a0184 === item.a0184).length > 1 && item.a0184 !== repeatNum) {
                repeatNum = item.a0184
                this.$confirm(item.a0101 + '(' + item.a0184 + ')身份证号在基本库中重复', '提示', {
                  type: 'warning'
                }).then(() => {
                }).catch(() => {
                })
              }
            })
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch((error) => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    inRoles (str) {
      let arr = JSON.parse(localStorage.getItem('Roles'))
      if (arr.indexOf(str) === -1) {
        return false
      } else {
        return true
      }
    },
    getDeptId () {
      let unitName = localStorage.getItem('unitName')
      let deptId = null
      switch (unitName) {
        case '干部一处':
          deptId = 1
          break
        case '干部二处':
          deptId = 2
          break
        case '干部三处':
          deptId = 3
          break
      }
      if (deptId) {
        this.userType = 2
        this.userTeam = deptId
      }
      if (this.inRoles('ROLE_training')) {
        this.userType = 1
      }
      if (this.inRoles('ROLE_fusizhang')) {
        this.userType = 3
      }
      if (this.inRoles('ROLE_sizhang')) {
        this.userType = 4
        this.myAuth = 1
      }
      this.getList()
    }
  },
  mounted () {
    this.getDeptId()
    if (localStorage.getItem('trainingAuth') === '1') {
      this.showManage = false
    } else {
      this.showManage = true
    }
    // this.getList()
    this.getAllUnitList()
    this.getYearList()
    // this.getAuth()
  }
}
</script>
<style>
  #trainIndex .wboxd .el-table th{
    font-weight: normal;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
  }
  #trainIndex .wboxd .el-table td,
  #train .el-table th{
    padding:0;
    font-size:var(--size14) !important;
    line-height: 20px;
    font-family: '宋体'
  }
  #trainIndex .el-table--border th,
  #train .el-table--border td {
    border-right: 1px solid #95B8E7;
  }
  #trainIndex .el-table th.is-leaf,
  #train .el-table td {
    border-bottom: 1px solid #95B8E7;
  }
  #trainIndex .el-table td{
    border-right: 1px solid #95B8E7;
    border-bottom: 1px solid #95B8E7;
  }
  .el-table .mark_class {
      background: rgb(253, 226, 226);
  }
</style>
<style scoped>
  #trainIndex h1{
    font-size:var(--size16) !important;
    font-weight: bolder;
    height: 30px;
    border-bottom: 1px solid #95B8E7;
    font-family: '宋体';
    line-height: 30px;
    color: #000;
    padding-left:10px;
    background-image: linear-gradient(to bottom , #EEF4FF, #E0ECFF);
    margin:0;
  }
  #trainIndex .el-pagination{
    float: left;
    padding:7px 10px;
  }
  #trainIndex .wboxs{
    padding:5px 15px;
    width: calc(100% - 30px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
  #trainIndex .wboxd{
    padding:0;
    width: calc(100% - 0px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
  #trainEditTable .el-upload--text{
    float:left !important;
  }
  #trainEditTable .el-upload__tip{
    float:left !important;
    margin-left:5px;
    margin-top:0 !important;
  }
  #trainEditTable .el-upload-list--text{
    padding-top:5px;
    clear: both !important;
  }
  .el-table{
    border-top: 1px solid #95B8E7 !important;
  }
  .el-table--border th, .el-table--border td {
    border-right: 1px solid #95B8E7 !important;
  }
  .el-table th.is-leaf, .el-table td {
    border-bottom: 1px solid #95B8E7 !important;
    border-right: 1px solid #95B8E7 !important;
  }
  #trainEditTable .mytable{
    border-top: 1px solid #74A6CC;
    border-left: 1px solid #74A6CC;
    margin: 10px;
    width: calc(100% - 20px);
    font-size:var(--size14) !important;
    font-family: '宋体'
  }
  #trainEditTable .mytable th,
  #trainEditTable .mytable td{
    height: auto;
    padding: 10px;
    border-right: 1px solid #74A6CC;
    border-bottom: 1px solid #74A6CC;
    vertical-align:top;
    line-height: 150%;
  }
  #trainEditTable .mytable th{
    background:#C0DCF1;
    width:150px;
    vertical-align: middle;
  }
</style>
